/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.google.code.smon.pers;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author xero
 */
@Entity
@Table(name = "server_type")
@NamedQueries({
    @NamedQuery(name = "ServerType.findAll", query = "SELECT s FROM ServerType s")})
public class ServerType implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "classname")
    private String classname;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "type")
    private Collection<Server> serverCollection;

    public ServerType() {
    }

    public ServerType(Integer id) {
        this.id = id;
    }

    public ServerType(Integer id, String classname) {
        this.id = id;
        this.classname = classname;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getClassname() {
        return classname;
    }

    public void setClassname(String classname) {
        this.classname = classname;
    }

    public Collection<Server> getServerCollection() {
        return serverCollection;
    }

    public void setServerCollection(Collection<Server> serverCollection) {
        this.serverCollection = serverCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ServerType)) {
            return false;
        }
        ServerType other = (ServerType) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.google.code.smon.pers.ServerType[ id=" + id + " ]";
    }
}
